//! @author Adam Emil Skoog
//! @date   2011-12-24

#ifndef KEDJA_EVENT_MANAGER_H_
	#define KEDJA_EVENT_MANAGER_H_
	#include <SFML/Graphics.hpp>

	namespace kedja
	 {
		namespace mouse
		 {
			/**
			 * Mouse buttons.
			 */
			enum Button
			 {
				left,
				middle,
				right,
				count
			 };
		 }

		/**
		 * This class handles events in an abstract way. It needs
		 * to be notified by an actual event system in order for
		 * the events to actually work.
		 */
		class EventManager
		 {
			public:
				// Declare functions.
				EventManager();
				void notifyMouseButtonIsDown(const mouse::Button &,const bool &);
				bool mouseButtonWasPressed(const mouse::Button &) const;
				bool mouseButtonWasReleased(const mouse::Button &) const;
				bool mouseButtonIsDown(const mouse::Button &) const;
				void notifyKeyIsDown(const sf::Key::Code &,const bool &);
				bool keyWasPressed(const sf::Key::Code &) const;
				bool keyWasReleased(const sf::Key::Code &) const;
				bool keyIsDown(const sf::Key::Code &) const;

			private:
				// Mouse button states.
				bool mouseButtonDown         [mouse::count],
				     mouseButtonDownLastFrame[mouse::count],
				     keyDown                 [sf::Key::Count],
				     keyDownLastFrame        [sf::Key::Count];

				// Declare functions.
				void beginFrame();
				void endFrame();

			friend class Component;
		 };
	 }
#endif
